package com.proj.model;

import java.util.ArrayList;
import java.util.List;

public class RecommendUser {
  private String userId;
  private List<RecommendType> recommendTypeList = new ArrayList<>();

  public RecommendUser() {}

  public RecommendUser(String userId) {
    this.userId = userId;
  }

  public RecommendUser set(Integer typeId, int score) {
    this.recommendTypeList.add(new RecommendType(typeId, score));
    return this;
  }

  public RecommendType find(Integer typeId) {
    for (RecommendType recommendType : recommendTypeList) {
      if (recommendType.typeId.equals(typeId)) {
        return recommendType;
      }
    }
    return null;
  }

  public String getUserId() {
    return userId;
  }

  public List<RecommendType> getRecommendTypeList() {
    return recommendTypeList;
  }

  @Override
  public String toString() {
    return "RecommendUser{"
        + "userId='"
        + userId
        + '\''
        + ", recommendTypeList="
        + recommendTypeList
        + '}';
  }
}
